import {
    createRouter,
    createWebHistory,
    createWebHashHistory
} from 'vue-router'
import Layout from '@/layout/index.vue'

const routes = [{
    path: '/demo',
    name: 'Demo',
    redirect: '/demo/test1',
    component: Layout,
    meta: {
        zh: "示例"
    },
    children: [{
        path: 'test1',
        name: "Test2",
        component: () => import('@/views/demo/test.vue'),
        meta: {
            zh: 'Vuex的使用'
        }
    }]
},
{
    path: '/test1',
    name: "Test1",
    component: () => import('@/views/demo/test.vue'),
    meta: {
        zh: 'Vuex的使用'
    }
}
]
// 创建路由模式
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
router.beforeEach((to, from, next) => {
    console.log(to)
    next()
})
export default router